package libs.game;

/**
 *              This interface will be implemented by classes which can solve games.
 *
 * @author      Jan Papousek
 * @version     2009-03-12
 */
public interface Solver {

    /**
     *          It returns a limit of steps of searching.
     *
     * @return  The searching limit.
     */
    int limit();

    /**
     *          It tries to make moves to change the situation one
     *          to situation two.
     *
     * @param   situation1      Original situation.
     * @param   situation2      Target situation.
     * @return   1 if the situation can be changed.
     *           0 if the solver does not know if the situation can be changed.
     *          -1 if the situation can't be changed.
     * @throws  IllegalArgumentException if the situations are not compatible.
     */
    int isSoluble(GamePlan situation1, GamePlan situation2);

    /**
     *          It tries to make moves to change the situation one
     *          to situation two and returns that moves.
     *
     * @param   situation1      Original situation.
     * @param   situation2      Target situation.
     * @return  Array of moves or null if there is no way to change the situation.
     * @throws  IllegalArgumentException if the situations are not compatible.
     * @throws  SolutionException if the solver does not know if the situation can be changed.
     */
    int[] solve(GamePlan situation1, GamePlan situation2) throws SolutionException;
    
}
